package com.example.androidbrowserpro;

import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.util.Log;

import com.zy.devicelibrary.data.GeneralData;
import com.zy.devicelibrary.data.HardwareData;
import com.zy.devicelibrary.data.StorageData;


public class MyTool {
    public static String getAndroidInfoJson(Context context) {
        HardwareData hardwareData = new HardwareData();
        GeneralData generalData = new GeneralData();
        StorageData storageData = new StorageData();
        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        //audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM,4,0);
        String msg =
                "\n设备型号:" + hardwareData.model +
                        "\n设备品牌:" + hardwareData.brand +
                        "\n产品名称:" + hardwareData.product +
                        "\n系统版本:" + hardwareData.release +
                        "\nSDK版本号:" + hardwareData.sdk_version_code +
                        "\n设备序列号:" + hardwareData.serial_number +
                        "\n硬件名:" + hardwareData.hardware +
                        "\n设备分辨率:" + hardwareData.resolution +
                        "\ncpu名字:" + hardwareData.cpu_type +
                        "\ncpu最小频率:" + hardwareData.cpu_min +
                        "\ncpu最大频率:" + hardwareData.cpu_max +
                        "\ncpu当前频率:" + hardwareData.cpu_cur +
                        "\n安卓ID:" + generalData.and_id +
                        "\nGAID:" + generalData.gaid +
                        "\n网络运营商名称:" + generalData.network_operator_name +
                        "\n当前网络类型:" + generalData.network_type +
                        "\n移动网络代码:" + generalData.mnc +
                        "\n设备标识符UUID:" + generalData.uuid +
                        "\nmac地址:" + generalData.mac +
                        "\n本地语言:" + generalData.language +
                        "\n运行内存总大小(单位byte):" + storageData.ram_total_size +
                        "\n运行内存可用大小(单位byte):" + storageData.ram_usable_size +
                        "\n内部存储总空间(单位byte):" + storageData.internal_storage_total +
                        "\n内部存储可用空间(单位byte):" + storageData.internal_storage_usable +
                        "\nsd卡总空间(单位byte):" + storageData.memory_card_size +
                        "\nsd卡已用空间(单位byte):" + storageData.memory_card_size_use +
                        "\n当前音量:" + audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) +
                        "\n最大音量:" + audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        //"\n最小音量:" + audioManager.getStreamMinVolume(AudioManager.STREAM_SYSTEM);
        Log.d("ScreenInfo", msg);
        return msg;
    }
}
